home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc19 / gemfsc19.lzh / INCLUDE / GEMFINTL.H < prev   
C/C++ Source or Header  |  1993-05-11  |  6KB  |  154 lines

  1. /**************************************************************************
  2.  * GEMFINTL.H - Stuff internal to the GemFast implementation.
  3.  *************************************************************************/
  4.  
  5. #ifndef GEMFINTL_H
  6. #define GEMFINTL_H
  7.  
  8. #include "gemfast.h"
  9.  
  10. #include <string.h>
  11. #include <stdio.h>
  12.  
  13. /*----------------------------------------------------------------------------
  14.  * some macros used to declare static functions in library internals.
  15.  *--------------------------------------------------------------------------*/
  16.  
  17. #define INTERNAL_VFUNC    static void GNEAR GREGARGS
  18. #define INTERNAL_IFUNC    static int    GNEAR GREGARGS
  19.  
  20. /*----------------------------------------------------------------------------
  21.  * mundane macros.
  22.  *--------------------------------------------------------------------------*/
  23.  
  24. #ifndef NULL
  25.   #define NULL ((void *)0)
  26. #endif
  27.  
  28. #ifndef TRUE
  29.   #define TRUE    1
  30.   #define FALSE 0
  31. #endif
  32.  
  33. /*----------------------------------------------------------------------------
  34.  * handy function-like macros.
  35.  *--------------------------------------------------------------------------*/
  36.  
  37. #define Array_els(a) ( sizeof(a) / sizeof((a)[0]) )
  38.  
  39. /*----------------------------------------------------------------------------
  40.  * Macros to get the 'real' value of object fields.
  41.  *    Extended objects have the ob_type and ob_spec moved out of the object
  42.  *    and into the XUSERBLK.    Library internals sometimes need the actual
  43.  *    object's ob_type or ob_spec, however (to determine whether to go after
  44.  *    the XUSERBLK values, for example), so these macros access the values
  45.  *    in the object itself.
  46.  *
  47.  *        OBXTYPE - the value of the extended object type
  48.  *        OBGTYPE - the value of the basic (GEM) object type
  49.  *        OBVSPEC - the value of the ob_spec
  50.  *        OBPSPEC - a pointer to the ob_spec
  51.  *        XUBPTR    - a pointer to the XUSERBLK or NULL if not an extended obj
  52.  *--------------------------------------------------------------------------*/
  53.  
  54. #define OBXTYPE(pobj)    ( ((unsigned char *)&((pobj)->ob_type))[0] )
  55.  
  56. #define OBGTYPE(pobj)    ( ((unsigned char *)&((pobj)->ob_type))[1] )
  57.  
  58. #define OBVSPEC(pobj)    ( ((pobj)->ob_flags & INDIRECT) ? \
  59.                             *(_Ob_spec_t*)(pobj)->_Ob_spec : (pobj)->_Ob_spec )
  60.  
  61. #define OBPSPEC(pobj)    ( ((pobj)->ob_flags & INDIRECT) ? \
  62.                             (_Ob_spec_t*)(pobj)->_Ob_spec : &((pobj)->_Ob_spec) )
  63.  
  64. #define XUBPTR(pobj)    ( (OBGTYPE(pobj) == G_USERDEF) ? _GetXub(pobj) : NULL )
  65.  
  66. /*-------------------------------------------------------------------------
  67.  * All dynamic dialogs get these options.
  68.  *-----------------------------------------------------------------------*/
  69.  
  70. #define FRM_DEFAULT_DYNOPT      (FRM_USEBLIT | FRM_MOVEABLE | FRM_MOUSEARROW)
  71. #define FRM_MANDATORY_DYNOPT  (FRM_CENTER  | FRM_DCOMPLETE)
  72.  
  73. /*-------------------------------------------------------------------------
  74.  * FormControl structure used by frm_dialog internals.
  75.  *-----------------------------------------------------------------------*/
  76.  
  77. typedef struct form_control {
  78.     OBJECT    *ptree;
  79.     void    *blitbuffer;
  80.     short    (*form_do) __PROTO((struct form_control *ctl));
  81.     long    options;
  82.     short    editobj;
  83.     short    parentobj;
  84.     short    moverobj;
  85.     short    defaultobj;
  86.     short    specialobj;
  87.     short    select_state;
  88.     short    treeflags;
  89.     GRECT    littlerect;
  90.     GRECT    scrnrect;
  91.     GRECT    *pboundrect;
  92. } FormControl;
  93.  
  94. /*-------------------------------------------------------------------------
  95.  * protos.
  96.  *-----------------------------------------------------------------------*/
  97.  
  98. extern long             _FrmDefaults;
  99.  
  100. extern void          (*_AesVCleanup) __PROTO((void));
  101.  
  102. extern void *         apl_malloc __PROTO((unsigned long amount));
  103. extern void          apl_free __PROTO((void *block));
  104. extern void          _ApXinit __PROTO((void));
  105.  
  106. extern FormControl * _FrmSetup __PROTO((FormControl *ctl, long options, OBJECT *ptree, GRECT *pboundrect));
  107.  
  108. extern void          frm_cleanup __PROTO((FormControl *ctl));
  109. extern FormControl * frm_init __PROTO((long options, OBJECT *ptree, GRECT *pboundrect));
  110. extern void          frm_start __PROTO((FormControl *ctl));
  111. extern void          frm_draw __PROTO((FormControl *ctl, short obj));
  112. extern void          frm_finish __PROTO((FormControl *ctl));
  113. extern void          frm_move __PROTO((FormControl *ctl));
  114. extern short         frm_do __PROTO((FormControl *ctl, short editobj));
  115. extern short         frm_mdo __PROTO((FormControl *ctl));
  116. extern void *         frm_dovector __PROTO((void *newfunc));
  117. extern char *         _FrmVFormat __PROTO((char *fmt, va_list args, short *plen));
  118. extern void          _FrmVFree __PROTO((char *buffer));
  119.  
  120. extern void          _FrmTrWidths __PROTO((OBJECT *tree, short parent, short width));
  121. extern short         _FrmDS2Obj __PROTO((char **ppstr, OBJECT *pobj, TEDINFO *pted, short *pwidth, short maxobjs));
  122. extern void          _FrmNLPatch __PROTO((char **patch_array));
  123. extern void          _FrmNL2DS __PROTO((char *strings, char **ptr_array, char **patch_array, short maxstrings));
  124.  
  125. extern void *        _GetXub __PROTO((OBJECT *pobj));
  126.  
  127. extern short         obj__draw __PROTO((OBJECT *tree, short obj, short depth, GRECT *cliprect));
  128.  
  129. /*----------------------------------------------------------------------------
  130.  * Define mnemonics for internal error codes.
  131.  *    Note that we set the base to the bottom of our staked-out range, and
  132.  *    let the enum increment upwards from there.    Our staked-out range is
  133.  *    currently -15199 thru -15100.
  134.  *--------------------------------------------------------------------------*/
  135.  
  136. #define GEMFAST_ERRNO_BASE (-15199)
  137.  
  138. enum {
  139.     gfErr_no_memory             = GEMFAST_ERRNO_BASE,
  140.     gfErr_vdi_handle,
  141.     gfErr_parameter_range,
  142.     gfErr_parameter_null,
  143.     gfErr_resource_in_use,
  144.     gfErr_wrong_type,
  145.     gfErr_option_invalid,
  146.     gfErr_action_invalid,
  147.     gfErr_object_too_small,
  148.     gfErr_object_too_big,
  149.     gfSuccess = 0
  150. };
  151.  
  152. #endif /* GEMFINTL_H */
  153.  
  154.